Phase 2: Replace NotebookLM with Gemini Deep Research API#630
Merged
codercatdev merged 10 commits intomainfrom Mar 5, 2026
Merged
Phase 2: Replace NotebookLM with Gemini Deep Research API#630codercatdev merged 10 commits intomainfrom
codercatdev merged 10 commits intomainfrom
Conversation
Moves hardcoded INFOGRAPHIC_INSTRUCTIONS to contentConfig.infographicInstructions array field. Alex can now add/remove/reorder prompts in Sanity Studio.
- Replace @google/generative-ai with @google/genai (new SDK with Interactions API support)\n- Lazy-init GoogleGenAI client in lib/gemini.ts\n- Migrate gemini-intent.ts and gemini-outreach.ts to new SDK\n- Add pipelineConfig fields: enableDeepResearch, deepResearchAgent, deepResearchPromptTemplate, infographicModel\n- Add matching TypeScript types to PipelineConfig interface\n\nUnblocks Sprint 2: Gemini Deep Research client + infographic generation service.
New Gemini Deep Research client using @google/genai Interactions API.\n\nExports: submitResearch, pollResearch, parseResearchReport, conductGeminiResearch.\nAll models/prompts from Sanity config. Two-phase parsing (Gemini Flash + regex fallback).\nBackward-compatible ResearchPayload output.
New infographic generation service using Imagen 4 Fast via @google/genai SDK.\n\nExports: generateInfographic, generateInfographicBatch, generateInfographicsForTopic, buildInfographicPrompt.\nModel + instructions from Sanity config. Deterministic seeds for brand consistency.\nPer-item fault isolation. ~$0.10 per topic (5 images).
Rewrite check-research cron route to use Gemini Deep Research + Imagen 4 Fast.\n\n- Replace NotebookLM polling with pollResearch() from gemini-research.ts\n- Replace NotebookLM infographic generation with generateInfographicsForTopic() from gemini-infographics.ts\n- Infographics now generated synchronously (no more async polling step)\n- enableDeepResearch toggle: skip to enriching when disabled\n- Legacy migration handler for docs stuck in infographics_generating\n- Backward compat: GROQ query matches both researchInteractionId and researchNotebookId\n- buildResearchPayload detects full ResearchPayload shape and passes through directly\n- Net -125 lines
Replace NotebookLM with Gemini Deep Research in ingest cron route.\n\n- Replace NotebookLM imports/calls with submitResearch() from gemini-research.ts\n- Gate behind enableDeepResearch config (was enableNotebookLmResearch)\n- Store researchInteractionId on automatedVideo doc\n- Add researchInteractionId field to automatedVideo Sanity schema\n- Keep old researchNotebookId/researchTaskId fields for backward compat\n- Fire-and-forget pattern preserved (submit, don't poll)
|
Deployment failed with the following error: Learn More: https://vercel.com/alex-pattersons-projects?upgradeToPro=build-rate-limit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2: Replace NotebookLM with Gemini Deep Research API
All 6 tasks complete. Full pipeline swap from NotebookLM to Gemini.
What shipped:
@google/generative-ai→@google/genai+ Deep Research config fieldslib/services/gemini-research.ts— Interactions API client (submit/poll/parse)lib/services/gemini-infographics.ts— Imagen 4 Fast infographic generationcheck-research/route.ts— Gemini polling + inline infographic generationingest/route.ts—submitResearch()replaces NotebookLM notebook creationPipeline flow:
submitResearch()→ storesresearchInteractionId→ status:researchingpollResearch()→parseResearchReport()→ status:research_completegenerateInfographicsForTopic()→ Sanity asset upload → status:enrichingscript_readyBuild verification:
tsc --noEmit— zero errorsnext build --webpack— compiled successfully (76s)PRIVATE_ALGOLIA_ADMIN_API_KEY(same on main, works on Vercel)Backward compatibility:
researchInteractionId(new) andresearchNotebookId(legacy)enableDeepResearchtoggle — when disabled, researching docs skip to enrichinginfographics_generatingdocs auto-advance to enriching